<template>
    <div>
<van-address-edit
  :area-list="areaList"
    :address-info="areaList"
     :tel="areaList.tel"
      :address="areaList.address"
  show-delete
 
  :show-area="false"
  @save="onSave"
  @delete="onDelete"

>

</van-address-edit>
    </div>
</template>

<script>
import { Toast } from 'vant';
import axios from "axios"
export default {
    name: 'Addro',
    data() {
        return {
            areaList:{},
           
        };
    },

    mounted() {
    let {id}=this.$route.params

        if(this.$route.params.id.length>2){
 
        }else{
            axios.post('/api/getaddrom',{id}).then(res=>{
           let {name,tel,address}=res.data.msg
              this.areaList={
                  name:name,
                  tel:tel,
                  addressDetail:address
              }
         
            })
        }
    },

 methods: {
  onSave(content) {
      Toast(name);
      axios.post("/api/addRedo",{content}).then(res=>{
                    console.log(res.data.msg)
                })
    },
    onDelete(content) {
          let {id}=this.$route.params
    axios.post('/api/detali',{id}).then(res=>{
            this.$router.push("/table")
            })
    },
  },
};

</script>

<style lang="scss" scoped>

</style>